﻿/*
Please note, this method does NOT work using jQuery methods with an element context, 
such as jQuery(‘div’).myNamespace.myMethod(). Your element context won’t be carried through to myMethod().

// definition

jQuery.namespace( 'jQuery.debug' ); // put in current context name of na namespace
jQuery.debug.test1 = function()
{
    alert( 'test1 function' );
};

// usage 
jQuery.debug.test1();

*/

(function (jQuery) {
    //create function that will allow to create namespases in current context   
    jQuery.namespace = function () {
        var a = arguments, o = null, i, j, d;
        for (i = 0; i < a.length; i = i + 1) {
            d = a[i].split(".");
            o = window;
            for (j = 0; j < d.length; j = j + 1) {
                o[d[j]] = o[d[j]] || {};
                o = o[d[j]];
            }
        }
        return o;
    };
} (jQuery)); 